package com.huike.game.common;

import java.util.Calendar;
import java.util.Date;

public class DataTools {

    /**
     * 通过时间戳 获取 星期
     *
     * @param time 时间戳
     * @return
     */
    public static String  week (String time){

        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date(Long.parseLong(time)));

        int week =  calendar.get(Calendar.DAY_OF_WEEK) -1;
        if(week < 0){
            week = 0;
        }

        String[] weekDay = {"星期日","星期一","星期二","星期三","星期四","星期五","星期六"};

        return weekDay[week];



        //        日期转时间戳
//        SimpleDateFormat dateFormat = new SimpleDateFormat("yyy-MM-dd");
//        //时间精确到毫秒 /1000
//        try {
//            Date parse = dateFormat.parse("2020-02-1");
//            long time = parse.getTime();
//            Log.e("---",time +"");
//        } catch (ParseException e) {
//            e.printStackTrace();
//        }
    }

}
